import Vue from 'vue'
import VueRouter from 'vue-router'

/* Layout */
import Layout from '@/layout'

/* Router Modules */

Vue.use(VueRouter)

/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 */

export const constantRoutes = [{
  path: '/redirect',
  component: Layout,
  hidden: true,
  children: [{
    path: '/redirect/:path*',
    component: () => import('@/views/redirect/index')
  }]
}, {
  path: '/login',
  component: () => import('@/views/login/index'),
  hidden: true
},
{
  path: '/',
  component: Layout,
  redirect: '/home',
  children: [{
    path: 'home',
    name: 'home',
    component: () => import('@/views/home/index'),
    meta: {
      title: '首页'
    }
  }]
},
{
  path: '/404',
  component: resolve => require(['@/views/404'], resolve),
  hidden: true
}
]
// 实例化vue的时候只挂载constantRouter
export default new VueRouter({
  routes: constantRoutes
})
// 动态需要根据权限加载的路由表
export const asyncRoutes = [
]
